package dao.impl;

import dao.BaseDao;
import dao.ClassifyDao;
import entity.Classify;
import entity.Userinfo;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

public class ClassifyDaoImpl extends BaseDao implements ClassifyDao {

    /**
     * 查询商品分类表
     * @return
     */
    @Override
    public List<Classify> selectclassify() {
        List<Classify> list=new ArrayList<>();
        Classify c=null;
        String sql="select * from classify";
        ResultSet rs=null;
        Connection conn=null;
        PreparedStatement ps=null;
        try {
            rs=exeQuery(sql, null,conn,ps);
            while (rs.next()){
                c=new Classify();
                c.setId(rs.getInt(1));
                c.setClassifyName(rs.getString(2));
                list.add(c);
            }
        } catch (Exception exception) {
            exception.printStackTrace();
        }finally {
            closeAll(rs,ps,conn);
        }
        return list;
    }
}
